import java.util.HashMap;
import java.util.Map;

/**
 * Created by 86135 on 2020/2/19.
 */
public class Test06 {
    public static void main(String[] args) {


        String[] srr = {"a","a","b","a","n","a","a","b"};
        Map<String,Integer> map = new HashMap<>();
        for (int i = 0; i < srr.length; i++) {
            if (srr[i].equals("a")){

            }else {
                if (map.get(srr[i]) == null){
                    map.put(srr[i],1);
                }else {
                    map.put(srr[i],map.get(srr[i])+1);
                }
            }
        }
        String[] ssr = new String[map.size()*2];
        int i = 0;
        for (String s : map.keySet()) {

            ssr[i] = s;
            ssr[i+1] = String.valueOf(map.get(s));
            i+=2;

        }
        for (int j = 0; j < ssr.length; j++) {
            System.out.println(ssr[j]);
        }
    }
}
